Advanced Swap Mode

This feature is new to version 0.5.2. It allows large computations to be carried
out that are otherwise too large to be done in Ram Only or Basic Swap Modes.



Multi-Hard Drive Support:

Advanced Swap Mode allows the use of multiple hard drives.
The purpose of this is to increase total disk bandwidth.

Like most forms of raid, the combined sustained bandwidth is equal to the speed
of the slowest drive times the # of drives. And similarly, the total accessible
disk space that y-cruncher will be able to use is equal the smallest drive times
the # of drives. (or rather the drive with least amount of free space)

Because of the uneven nature of hard drives (with respect to different addresses),
performance is highly affected by current disk usage and fragmentation.
Performance will therefore be best when all drives are empty and freshly formatted.


This feature is somewhat redundant of hardware Raid 0. However, it has one major
advantage over Raid 0. There is no limit to the # of drives that can be combined.
Furthermore, it scales linearly with the # of drives. (barring other hardware limitations)
In the cases where Raid 0 fails to scale linearly with bandwidth, it is usually
beneficial to just let y-cruncher manage the drives separately.

So if one wishes to use 12 hard drives, but only has 3 controllers that can
handle at most 4-way Raid 0, then one can combine them into 3 sets of 4-way Raid 0
- producing 3 logical drives which y-cruncher can manage manually.



How much combined bandwidth is "enough"?
Regardless of how many drives are used, there will always be portions of a
computation that are limited by disk bandwidth. So more drives will always help
until you begin to hit hardware limits that prevent further scaling. (such as
saturating the South Bridge or the PCI bus)

Nevertheless, the recommendations are as follows:
These correspond to the approximate 50/50 points where a typical computation
spends roughly 50% of the time waiting on CPU and 50% of the waiting on disk.

    Intel Pentium D              @ 2.8  GHz -  50 MB/s
    Intel Core 2 Duo             @ 2.4  GHz - 100 MB/s
    Intel Core 2 Quad (1066 FSB) @ 2.4  GHz - 180 MB/s*
    Intel Core 2 Quad (1333 FSB) @ 3.0  GHz - 220 MB/s*
    AMD Phenom II X4             @ 3.2  GHz - 250 MB/s
    Intel Core i7                @ 2.66 GHz - 300 MB/s
    Intel Core i7                @ 3.5  GHz - 400 MB/s
2 x Intel Xeon 54xx (Harpertown) @ 3.2  GHz - 500 MB/s*
2 x Intel Xeon 55xx (Gainestown) @ 3.33 GHz - 800 MB/s
2 x Intel Xeon 56xx (Gulftown)   @ 3.33 GHz -   1 GB/s


*All Core 2 Quad-based processors are very sensitive to memory bandwidth and FSB speeds.
*Most 7200 RPM hard drives larger than 500 GB are able to sustain 100 MB/s.
*Frequencies scale roughly linearly on all processors, so you can adjust the
bandwidth accordingly.
*Note that these estimates are based on actual benchmarks for the corresponding systems.




Working Memory:

Unlike the Ram Only and Basic Swap modes, Advanced Swap Mode lets you select your
working memory.

Generally speaking, the more memory you give the program, the faster it will run
simply because it can do more work in ram before having to use the disk.

The "minimum" and "recommended" values are dependent on the "Min I/O Size" option.




Buffering Control (I/O Buffer):

Advanced Swap Mode uses a buffer to perform the data interleaving for the striping.
The default size of this buffer is 2 MB per disk.

Starting from v0.5.2.9072, y-cruncher uses raw I/Os. This bypasses all OS and
file-system overhead.

The recommendation for this option is to leave it at its default setting unless
you plan on messing with the hardware buffering settings.




Minimum Sequential Access Size (Min I/O Size):

There are a number of places in Advanced Swap Mode that require non-sequential I/Os.
The larger the computation size, the more non-sequential the I/Os will become.
The larger the working memory is, the more sequential the I/Os will become.

In cases where the computation is large enough such that non-sequential I/Os become
bottlenecked by disk seeks (as opposed by disk bandwidth), it offers an alternate
algorithm that will make I/Os more sequential at the cost of more I/Os (in bytes).
(This corresponds to 3-step and 5-step convolution algorithms.)

The value of this setting determines when the program will switch to the more
sequential algorithm. The drawback is of course a greater number of I/Os.

By default, this setting is set at 2 MB. The program will switch to the
more-sequential algorithm whenever it needs to perform non-sequential disk access
in blocks of less than this setting.

2 MB is tuned to the latest 7200 RPM hard drives as of 2010.
Older hard drives and "high performance 15k" drives may benefit from a smaller setting.

Generally speaking, this setting only begins to matter when pushing above 50 billion
digits with a very small amount of ram. (using the newest hardware as of 2010)



The optimal value for this setting is directly related to the (bandwidth / seek time)
ratio of the hard drive.

The higher the (bandwidth / seek time) ratio of the logical drive, the higher the
optimal setting will be.
Similarly, the lower the ratio, the lower the optimal setting is.

This means that Raid 0 as well as the use of "high-performance drives" (such as 15k
drives) will alter the optimal "Min I/O Size" setting.



The general rule of thumb when using Raid 0 is that the Min I/O Size should be
scaled up proportionally with the # of drives in the Raid 0 array.

Examples: (using 2MB as the base value)

1 drive         (1 logical drive , 1 physical drive  ) - Min I/O Size = 2 MB
2 drives        (2 logical drives, 2 physical drives ) - Min I/O Size = 2 MB
1 x 2-way RAID0 (1 logical drive , 2 physical drives ) - Min I/O Size = 4 MB

4 x 1 (No RAID) (4 logical drives, 4 physical drives ) - Min I/O Size = 2 MB
2 x 2-way RAID0 (2 logical drives, 4 physical drives ) - Min I/O Size = 4 MB
1 x 4-way RAID0 (1 logical drive , 4 physical drives ) - Min I/O Size = 8 MB

8 x 1 (No RAID) (8 logical drives, 8 physical drives ) - Min I/O Size = 2 MB
4 x 2-way RAID0 (4 logical drives, 8 physical drives ) - Min I/O Size = 4 MB
2 x 4-way RAID0 (2 logical drives, 8 physical drives ) - Min I/O Size = 8 MB

6 x 1 (No RAID) (6 logical drives, 6 physical drives ) - Min I/O Size = 2 MB
3 x 2-way RAID0 (3 logical drives, 6 physical drives ) - Min I/O Size = 4 MB
2 x 3-way RAID0 (2 logical drives, 6 physical drives ) - Min I/O Size = 6 MB
1 x 6-way RAID0 (1 logical drive , 6 physical drives ) - Min I/O Size = 12 MB



For computations that will fill up more than 50% of the total space in the hard
drives, it is recommended to use a base setting of 4MB instead of 2MB. This is
because the average seek times are higher when the working set covers the entire disk.




